<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
	xmlns:a="http://richfaces.org/a4j"
    template="/layout/template.xhtml">

<ui:define name="body">

	<h:form id="createTravelForm">
		<rich:panel>
		<f:facet name="header">Select a date</f:facet>
			<h:panelGrid columns="2">
				   
				<s:div>
					<rich:messages />
					<s:decorate id="travelDate1Field" template="/layout/edit.xhtml">
		                <ui:define name="label">Travel begin date</ui:define>
		                <rich:calendar id="travelDate1"
		                       required="true"
		                          value="#{travelCreationData.travelDate1}" datePattern="MM/dd/yyyy" firstWeekDay="1">		                </rich:calendar>
		            </s:decorate>
		            
		            
		            <s:decorate id="travelDate2Field" template="/layout/edit.xhtml" rendered="#{travelCreationData.periodType.equals('periodOfTime')}">
		                <ui:define name="label">Travel end date</ui:define>
		                <rich:calendar id="travelDate2"
		                       required="true"
		                          value="#{travelCreationData.travelDate2}" datePattern="MM/dd/yyyy" firstWeekDay="1">

		                </rich:calendar>
		            </s:decorate>
		            
				</s:div>
				
				
				
				<s:div>
				<a:region>
					<h:selectOneRadio value="#{travelCreationData.repType}" >
						<f:selectItem itemValue="everyDay" itemLabel="Every day" />
						<f:selectItem itemValue="workingDay" itemLabel="Working day"/>
						<f:selectItem itemValue="weekend" itemLabel="Weekend"/>
						<f:selectItem itemValue="selectedDays" itemLabel="Selected days"/>
						<a:support event="onchange"   reRender="repInfoDiv" />
					</h:selectOneRadio> 
					
					<rich:panel id="repInfoDiv">
						<f:facet name="header">Repetition data</f:facet>
						<h:panelGrid >
							<s:div rendered="#{travelCreationData.repType.equals('everyDay')}">
								The travel will be made every week day.
							</s:div>
							<s:div rendered="#{travelCreationData.repType.equals('workingDay')}">
								The travel will be made every working day.
							</s:div>
							<s:div rendered="#{travelCreationData.repType.equals('weekend')}">
								The travel will be made weekend days only.
							</s:div>
							<s:div rendered="#{travelCreationData.repType.equals('selectedDays')}">
								The travel will be made the week days selected below:
								<h:selectManyCheckbox value="#{travelCreationData.selectedDays}">
									<f:selectItem itemValue="MON" itemLabel="Monday" />
									<f:selectItem itemValue="TUE" itemLabel="Tuesday" />
									<f:selectItem itemValue="WED" itemLabel="Wednesday" />
									<f:selectItem itemValue="THU" itemLabel="Thursday" />
									<f:selectItem itemValue="FRI" itemLabel="Friday" />
									<f:selectItem itemValue="SAT" itemLabel="Saturday" />
									<f:selectItem itemValue="SUN" itemLabel="Sunday" />
								</h:selectManyCheckbox>
							</s:div>
							
						</h:panelGrid>
					</rich:panel>
					
				</a:region>
				</s:div>

			</h:panelGrid>
		</rich:panel>

        
        <div class="actionButtons">
			<h:commandButton id="summary"
                          value="View Summary"
                         action="#{createTravelBean.selectMultiDateAction}"/>
        </div>
		
	</h:form>
        
        
</ui:define>
</ui:composition>
